import time
from ctypes import *
import pyautogui

while True:
    week_day = time.strftime('%a', time.localtime())
    if week_day == 'Wed':
        work_hour = 8
    else:
        work_hour = 9
    hour = time.strftime('%H', time.localtime())
    hour_int = int(hour)
    lock_status = 0  # 0则表示锁屏
    need_judge_time = True
    input_hour = 9
    input_min = 0
    print(hour_int)
    if 10 > hour_int >= 9 and need_judge_time:
        u = windll.LoadLibrary('user32.dll')
        result = u.GetForegroundWindow()
        if result != lock_status:
            login_window_time = pyautogui.prompt(text='输入当前时间，举例：9.13', title='PyAutoGUI消息框', default='请输入')
            try:
                input_time = time.strptime(login_window_time, '%H.%M')
                input_hour = input_time.tm_hour
                input_min = input_time.tm_min
                need_judge_time = False
            except:
                print("时间输入错误")
    while True and not need_judge_time:
        strftime = time.strftime('%H:%M', time.localtime())
        end_hour = input_hour + work_hour
        input_time = time.strftime('%H:%M', time.strptime(str(end_hour) + ":" + str(input_min), '%H:%M'))
        if input_time == strftime:
            pyautogui.alert(text='下班啦~啦~啦~啦~啦', title='PyAutoGUI消息框', button='OK')
            break
        else:
            time.sleep(5)
    time.sleep(5)
